<%--
 *  File:    doctorEdit.jsp
 *  @Author: awesomewang
 *  Date:    2009/10/22
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>

<iframe name="reloadHandler" style="display:none"></iframe>
<%//init param
			Category cat = Category.getInstance("jsp.OrgEdit");
			String strPrivCode = (String) request.getParameter("third");
			if (strPrivCode == null)
				strPrivCode = (String) session.getAttribute("third");
			if (strPrivCode == null)
				strPrivCode = "";
			String privilegeCode = strPrivCode;
			String strModuleName = "OGM";
			String contextPath = request.getContextPath();

			%>



<%@ include file="/inc/Security.inc"%>
<%@ include file="/inc/PageDefault.inc"%>

<html>
<head>
<title>doctorEdit.jsp</title>

<PageFlow:CheckPageFlow pageName="p_doctoredit"/>
<%
	HashMap hospitalinfo = (HashMap) pageContext.getAttribute("hospitalinfo");
	if (hospitalinfo == null)
		hospitalinfo = new HashMap();
	
	HashMap hpinfo = (HashMap) pageContext.getAttribute("hpinfo");
	if (hpinfo == null)
		hpinfo = new HashMap();
%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/Calendar.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<script language="JavaScript">


function page_done(){
  if(!checkForm(frm)) return; 		
	
  document.frm.actionname.value="add";
  //document.frm.target="_parent";
  isRunning = true;
  document.frm.submit(); 
}

function page_back(){
	var ishistory = frm.ishistory.value;
	
	var contactid = frm.contactid.value;
	var customerid = frm.customerid.value;
	//alert(customerid);
	var processid = frm.processid.value;
	var year = frm.year.value;
	var monthofyear = frm.monthofyear.value;
	var weekofmonth = frm.weekofmonth.value;
	var dayofweek = frm.dayofweek.value;
	var dayofmonth = frm.dayofmonth.value;
	//document.frm.target="_parent";
	parent.location.href="../../sfe/VisitPlanFeedbackSummaryFrm.jsp?<%= OvalTools.randomURL() %>&ishistory="+ishistory+"&customerid="+customerid+"&processid="+processid+"&contactid="+contactid+"&year="+year+"&weekofmonth="+weekofmonth+"&dayofweek="+dayofweek+"&dayofmonth="+dayofmonth+"&monthofyear="+monthofyear;
  
}



function setcontactname(contantelement){

	var code = contantelement.value;
  	var  datahandler = new  DataHandler() ;
  	datahandler.add_params("contactcode" , code,"string") ;
  	datahandler.add_params("languagecode" , 'cn',"string") ;
  	
  	datahandler.getResultFromHashMap("contactinfo" ,"contactcode" ,"document.frm.contactcode");
  	datahandler.getResultFromHashMap("contactinfo" ,"contactname" ,"document.frm.contactname");
  	datahandler.getResultFromHashMap("contactinfo" ,"contactid" ,"document.frm.salesrepid");
  	
  	datahandler.add_job("j_getcontactbycode") ;
    datahandler.runDataHandler ();
}
function set_contactNameByPopWindow(id,name,code){
	
	document.frm.contactcode.value=code;
	document.frm.contactname.value=name;
	document.frm.salesrepid.value=id;

}

function popWindowShowContactPage(){
	var url = "popWindowContactInfo.jsp?"+"<%= OvalTools.randomURL() %>"+"&orgid=1&languagecode=<%=strLanguageCode%>";
	var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
	if(popwindow!=null)
    popwindow.close();
    
  	popwindow = window.open(url,'ContactInfo',windowAttribute);
}

function sethospitalname(contantelement){
	var code = contantelement.value;
  	var  datahandler = new  DataHandler() ;
  	datahandler.add_params("orgcode" , code,"string") ;
  	datahandler.add_params("languagecode" , 'cn',"string") ;
  	
  	datahandler.getResultFromHashMap("hospitalinfo" ,"orgcode" ,"document.frm.orgcode");
  	datahandler.getResultFromHashMap("hospitalinfo" ,"orgname" ,"document.frm.orgname");
  	datahandler.getResultFromHashMap("hospitalinfo" ,"orgid" ,"document.frm.orgid");
  	datahandler.getResultFromHashMap("hospitalinfo" ,"orgid" ,"document.frm.hpid");
  	
  	datahandler.add_job("j_getorgbycode") ;
    datahandler.runDataHandler ();
}

function set_orgNameByPopWindow(id,name,code){	
	document.frm.orgcode.value=code;
	document.frm.orgname.value=name;
	document.frm.hpid.value=id;
	document.frm.orgid.value=id;
}

function popWindowShowHospitalPage(){
	var url = "../ogm/OrgPopWindow.jsp?"+"<%= OvalTools.randomURL() %>"+"&globalpccode=111&languagecode=<%=strLanguageCode%>";
	var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
	if(popwindow!=null) popwindow.close();    
  	popwindow = window.open(url,'hospitalinfo',windowAttribute);
}

function popWindowsDocProd(){
	if ((document.frm.doctorid.value==null)||(document.frm.doctorid.value.length <= 0)||(document.frm.doctorid.value=="null")){
    	alert("<%=message.getMessageDesc("SAVE_INFO_FIRST")%>");
        return;
    }
	var doctorid = frm.doctorid.value;
	var orgid = frm.hpid.value;
	var url = "doctorProdPopWindow.jsp?"+"<%= OvalTools.randomURL() %>"+"&doctorid="+doctorid+"&orgid="+orgid;
	var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
	if(popwindow!=null) popwindow.close();
 	popwindow = window.open(url,null,windowAttribute);
}

function showPopWindowsDocProdContact(){
	if ((document.frm.doctorid.value==null)||(document.frm.doctorid.value.length <= 0)||(document.frm.doctorid.value=="null")){
    	alert("<%=message.getMessageDesc("SAVE_INFO_FIRST")%>");
        return;
    }
	var doctorid = frm.doctorid.value;
	var orgid = frm.hpid.value;
	var url = "doctorProdContactInfoPopWindow.jsp?"+"<%= OvalTools.randomURL() %>"+"&doctorid="+doctorid+"&orgid="+orgid;
	var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
	if(popwindow!=null) popwindow.close();
 	popwindow = window.open(url,null,windowAttribute);
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td class="summary_top"></td>
	</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0">
	<form name="frm" method="post" action="<%=contextPath %>/Dispatcher" target="_self">
    <input type="hidden" name="pagename" value="p_doctoredit">
	<input type="hidden" name="actionname">
	<input type="hidden" name="doctorid" value="<%= hospitalinfo.get("doctorid") %>">
	<input type="hidden" name="category" value="11">
	<input type="hidden" name="hpid" value="<%= hpinfo.get("orgid") %>">
	<input type="hidden" name="orgid" value="<%= hpinfo.get("orgid") %>">
	
	<custom:hidden property="contactid" />
	<custom:hidden property="year" />
	<custom:hidden property="monthofyear" />
	<custom:hidden property="weekofmonth" />
	<custom:hidden property="dayofweek" />
	<custom:hidden property="dayofmonth" />
	<custom:hidden property="processid" />
	<custom:hidden property="ishistory" />
	<custom:hidden property="customerid" />
	
	
	<tr>
		<td valign="top">
		<table border="1" cellspacing="0" bordercolorlight="#999999"
			bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
			<span id="editbody">
			<tr>
				<td colspan="4" class="deepblue-left"><img src="<%=contextPath %>/images/<%= strLanguageCode %>/quote.gif">
			</tr>
			<%
				boolean isAuto = pageContext.getAttribute("isauto") != null&& pageContext.getAttribute("isauto").toString().equalsIgnoreCase("Y");
				String codeClass = isAuto ? "td-text" : "need";
				String codeIsNull = isAuto ? "Y" : "N";
				String codeISDisabled = isAuto ? "true" : "false";

			%>
			
			<tr>
				<td class="td-text"><%=label.getLabelName("L_DoctorCode")+ label.getLabelName("L_Colon")%></td>
				<td ><custom:text name="hospitalinfo" property="doctorcode" readonly="true" style = "border:0"/></td>
				<td class="td-text"><%=label.getLabelName("L_OldOrgcode2")+ label.getLabelName("L_Colon")%>  </td>
				<td>
				<custom:write name="hospitalinfo" property="old_doctorcode" nbsp="true" /></td>
			</tr>			
			<tr>
				<td class="need"><%=label.getLabelName("L_DoctorName")+ label.getLabelName("L_Colon")%></td>
				<td><custom:text name="hospitalinfo" property="doctorname" command="notnull" label="L_DoctorName" /></td>
				<td class="need"><%=label.getLabelName("L_GenderName")+ label.getLabelName("L_Colon")%></td>
				<td><custom:selectdic name="hospitalinfo" property="gender" dictType="Gender" valueCriteria="1-2" /></td>
			</tr>
			<tr>
				<td class="need"><%=label.getLabelName("L_Property")+ label.getLabelName("L_Colon")%></td>
				<td><custom:selectdic name="hospitalinfo" property="doctortype" dictType="WorkStatus"  /></td>
				<td class="td-text"><%=label.getLabelName("L_OfficePhone")+ label.getLabelName("L_Colon")%></td>
				<td><custom:text name="hospitalinfo" property="telephone" label="L_OfficePhone" /></td>
			</tr>
			<tr>
				<td class="need"><%=label.getLabelName("L_Department1")+ label.getLabelName("L_Colon")%></td>
				<td><custom:selectdic name="hospitalinfo" property="department" dictType="HospitalDepartment"
					valueCriteria="1-max" /></td>
				<td class="td-text"><%=label.getLabelName("L_CellPhone")+ label.getLabelName("L_Colon")%></td>
				<td><custom:text name="hospitalinfo" property="cellphone" label="L_CellPhone" /></td>
			</tr>
			<tr>
				<td class="td-text"><%=label.getLabelName("L_Hospital")+ label.getLabelName("L_Colon")%></td>
		    	<td><custom:write name="hpinfo" property="orgcode" /> 		    			 
		    	<!-- 	<a onclick="javascript:popWindowShowHospitalPage();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a>  -->
		    		<custom:write name="hpinfo" property="orgname" /></td>
				<td class="need"><%=label.getLabelName("L_Status")+ label.getLabelName("L_Colon")%></td>
				<td><custom:selectdic name="hospitalinfo" property="status" dictType="Status"	valueCriteria="41" /></td>	
			</tr>
			<tr>
				<td class="td-text"><%=label.getLabelName("L_HospitalOutpatient") + label.getLabelName("L_Colon")%></td>
				<td><custom:text name="hospitalinfo" property="outpatientqty" /></td>		
				<td class="need"><%=label.getLabelName("L_Product")+ label.getLabelName("L_Colon")%></td>
				<td><a onclick="javascript:popWindowsDocProd();"> 
						<custom:button	type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a></td>
			</tr>
			<tr>
				<td class="td-text" ><%=label.getLabelName("L_Comments") + label.getLabelName("L_Colon")%></td>
				<td colspan="3"><custom:text name="hospitalinfo" property="comments" size="30" /></td>
				<!--  td class="need"><%=label.getLabelName("L_Rep")+ label.getLabelName("L_Colon")%></td>
				<td><a onclick="javascript:showPopWindowsDocProdContact();"> 
						<custom:button	type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a></td>-->
			</tr>	
		</table>
		</td>
	</tr>

	<tr>
		<td class="summary_top"></td>
	</tr>
	<tr>
		<td height="49" class="td_center">
		<a onclick="page_done()"><custom:button	type="1" label="L_Save" imgsrc="finish.gif" border="0" style="width:60" /></a>
		<a onclick="page_back()"><custom:button	type="1" label="L_Back" imgsrc="finish.gif" border="0" style="width:60" /></a>
		</td>

	</tr>

</table>

</body>
</html>



